/******************************************************************************
Copyright:
2009 Jens Collin (jens.collin@dinomin.com)

This file is part of Envox Decompiler.

Envox Decompiler is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Envox Decompiler is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with KitchenOS.  If not, see <http://www.gnu.org/licenses/>.

******************************************************************************/
using System;

namespace EnvoxDecompiler
{

    /// <summary>
	/// Summary description for Class1.
	/// </summary>
	class MainClass
	{
        /// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main(string[] args)
		{
			// Create settings from arguments passed on commandline
			if (!Settings.Instance.SetupFromArgs(args))
			{
				return;
			}
            Settings.Instance.PrintVersion();

			Decompiler decompiler = new Decompiler();
			if (!decompiler.Load(Settings.Instance.inputFilename))
			{
				Trace.Error("Failed to load input file '"+Settings.Instance.inputFilename + "'");
				return;
			}
            
			if (!decompiler.Decompile())
			{
				Trace.Error("Failed to decompile "+Settings.Instance.inputFilename);
				return;
			}
			decompiler.Save(Settings.Instance.outputFilename);
			Trace.Info("Decompile completed.");
//			System.Threading.Thread.Sleep(3000);
		}
	}
}
